<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const sy = Symbol();

        let a = {};
        a[sy] = '你好';
        a['name'] = '名称';

        // let a = {
        //     // []代表用sy这个变量作为key值,否则key值为字符串
        //     [sy]: '你好'
        // };

        // let a = {};
        // Object.defineProperty(a, sy, { value: '你好defineProperty'} );

        console.log('a:',a);

        // 通过Object.getOwnPropertySymbols方法来遍历Symbol，且只可以遍历出其中的Symbol
        const arr = Object.getOwnPropertySymbols(a);
        console.log('symbol arr:', arr);
        
    </script>
</body>
</html>